Time series analysis on air pollutants data from Wanshouxigong(Beijing) air-quality monitoring site

Data source: https://archive.ics.uci.edu/ml/datasets/Beijing+Multi-Site+Air-Quality+Data

The data set includes hourly air pollutants data from 12 nationally-controlled air-quality monitoring sites. The air-quality data are from the Beijing Municipal Environmental Monitoring Center. The meteorological data in each air-quality site are matched with the nearest weather station from the China Meteorological Administration. The time period is from March 1st, 2013 to February 28th, 2017. Missing data are denoted as NA.

Attribute Information:

No: row number

year: year of data in this row

month: month of data in this row

day: day of data in this row

hour: hour of data in this row

PM2.5: PM2.5 concentration (ug/m^3)

PM10: PM10 concentration (ug/m^3)

SO2: SO2 concentration (ug/m^3)

NO2: NO2 concentration (ug/m^3)

CO: CO concentration (ug/m^3)

O3: O3 concentration (ug/m^3)

TEMP: temperature (degree Celsius)

PRES: pressure (hPa)

DEWP: dew point temperature (degree Celsius)

RAIN: precipitation (mm)

wd: wind direction

WSPM: wind speed (m/s)

station: name of the air-quality monitoring site

loading library

library(corrplot)
library(RColorBrewer)
library(tidyr)
library(dplyr)
library(data.table)
library(seasonal)
library(forecast)
library(dplyr)
library(TSstudio)
library(xts)
library(tseries)
library(ggplot2)
library(lattice)
data <- read.csv("PRSA_Data_Wanshouxigong_20130301-20170228.csv", header = TRUE)

We are going to study the air pollution condition in Beijing, Wanshou xigong.

attach(data)

Checking the number of missing value

sum(is.na(data))
## [1] 5146

There are 5146 cells contain missing values.

fill the missing value

column_nane_list <- colnames(data)

for (a in column_nane_list){
  data <-data %>% fill(a,.direction = 'updown')
}
## Warning: Using an external vector in selections was deprecated in tidyselect 1.1.0.
## ℹ Please use `all_of()` or `any_of()` instead.
##   # Was:
##   data %>% select(a)
## 
##   # Now:
##   data %>% select(all_of(a))
## 
## See <https://tidyselect.r-lib.org/reference/faq-external-vector.html>.
sum( apply(data,2, function(x) is.na(x)))
## [1] 0

We fill the missing values by the previous value.If the previous value is not available, we will fill by the next value.

aggregate data, group the data by year, month and day

There are two type of information in the data set. One is the different index of the air pollutants (e.g. PM2.5, PM10, SO2, NO2, CO, O3). And the other type is the weather condition (e.g. TEMP, PRES, DEWP, RAIN, wd, WSPM).

grouped_year = aggregate(cbind(PM2.5,PM10,SO2,NO2,CO,O3,TEMP,PRES,DEWP,RAIN,WSPM) ~ data$year, data = data, FUN = mean, na.rm = TRUE)

grouped_month = aggregate(cbind(PM2.5,PM10,SO2,NO2,CO,O3,TEMP,PRES, DEWP,RAIN,WSPM) ~ data$year+ data$month, data = data, FUN = mean, na.rm = TRUE)

grouped_day = aggregate(cbind(PM2.5,PM10,SO2,NO2,CO,O3,TEMP,PRES, DEWP,RAIN,WSPM) ~ data$year+ data$month + data$day, data = data, FUN = mean, na.rm = TRUE)

grouped_year <- grouped_year[
  order( grouped_year[,1] ),
]

grouped_month <- grouped_month[
  order( grouped_month[,1], grouped_month[,2] ),
]

grouped_day <- grouped_day[
  order( grouped_day[,1], grouped_day[,2], grouped_day[,3] ),
]

we first analysis the monthly data

Plot the linear correlation between diffrent variable

corr_month <- cor(grouped_month[,-c(1:2)])

corrplot(corr_month, type="upper", order="hclust",
         col=brewer.pal(n=8, name="RdYlBu"))

We have found that the air pollutants have high correlation between each other (e.g. PM2.5, PM10, CO, SO2 and NO2 has positive correlation, but O3 has the negativity correlation with other air pollutants.)

And we also have found that the weather conditions also have high correlation with the air pollutants (e.g temperature, precipitation has negativity correlation with air pollutant(PM2.5,PM10, CO, SO2, NO2))

convert dataframe to timeframe object

grouped_month  <- grouped_month [,-c(1:2)]

ts_by_month <- ts(grouped_month , start = c(2013, 3), frequency = 12)

variables against time plot

plot.ts(ts_by_month[,1:6])

plot.ts(ts_by_month[,7:11])

plot the box plot for variable in the cycle (month)

# cycle(ts_by_month)

boxplot(ts_by_month [,'PM2.5'] ~ cycle(ts_by_month [,'PM2.5']))

boxplot(ts_by_month [,'PM10'] ~ cycle(ts_by_month [,'PM10']))

boxplot(ts_by_month [,'SO2'] ~ cycle(ts_by_month [,'SO2']))

boxplot(ts_by_month [,'NO2'] ~ cycle(ts_by_month [,'NO2']))

boxplot(ts_by_month [,'CO'] ~ cycle(ts_by_month [,'CO']))

boxplot(ts_by_month [,'O3'] ~ cycle(ts_by_month [,'O3']))

boxplot(ts_by_month [,'TEMP'] ~ cycle(ts_by_month [,'TEMP']))

boxplot(ts_by_month [,'DEWP'] ~ cycle(ts_by_month [,'DEWP']))

boxplot(ts_by_month [,'PRES'] ~ cycle(ts_by_month [,'PRES']))

boxplot(ts_by_month [,'RAIN'] ~ cycle(ts_by_month [,'RAIN']))

boxplot(ts_by_month [,'WSPM'] ~ cycle(ts_by_month [,'WSPM']))

We can observe the distribution of difference variable among month

There are periodic pattern among month.

For example, the PM2.5 concentration is lower and less variate at May to Sept, but higher and more variate at Dec to Feb.

The precipitation is more variate at summer (Especially July).

Plot the heat map

ts_heatmap(ts_by_month[,'PM2.5'],title = " Heatmap - the PM2.5 concentration in Wanshou xigong")
ts_heatmap(ts_by_month[,'PM10'],title = " Heatmap - the PM10 concentration in Wanshou xigong")
ts_heatmap(ts_by_month[,'SO2'],title = " Heatmap - the SO2 concentration in Wanshou xigong")
ts_heatmap(ts_by_month[,'NO2'],title = " Heatmap - the NO2 concentration in Wanshou xigong")
ts_heatmap(ts_by_month[,'CO'],title = " Heatmap - the CO concentration in Wanshou xigong")
ts_heatmap(ts_by_month[,'O3'],title = " Heatmap - the O3 concentration in Wanshou xigong")
ts_heatmap(ts_by_month[,'TEMP'],title = " Heatmap - the TEMP in Wanshou xigong")
ts_heatmap(ts_by_month[,'PRES'],title = " Heatmap - the PRES in Wanshou xigong")
ts_heatmap(ts_by_month[,'RAIN'],title = " Heatmap - the RAIN in Wanshou xigong")

The heat maps shows the level of the variable. The darker color means that the level is higher.

For example, the PM2.5 concentration level is higher in winter than summer. The Temperature is higher in summer than winter.

Weekly Analysis

convert_date_to_weekday <- function(day, month, year){
  date <- as.POSIXlt(paste(as.character(year) , as.character(month), as.character(day), sep="-"), tz = "UTC")
  weekday <- weekdays(date)
  return (weekday)
}
data_weekday <- data

data_weekday$weekday <- mapply(convert_date_to_weekday, data$day, data$month, data$year)

grouped_weekday_year = aggregate(cbind(PM2.5,PM10,SO2,NO2,CO,O3,TEMP,PRES, DEWP,RAIN,WSPM) ~ weekday , data = data_weekday, FUN = mean, na.rm = TRUE)

grouped_weekday_year$weekday <- factor(grouped_weekday_year$weekday, levels = c("Monday", "Tuesday","Wednesday","Thursday", "Friday","Saturday","Sunday"))


weekdayorder = c("Monday", "Tuesday","Wednesday","Thursday", "Friday","Saturday","Sunday")

grouped_weekday_year = grouped_weekday_year[order(match(grouped_weekday_year$weekday,weekdayorder)),]

xyplot( PM2.5 ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
)

xyplot( PM10 ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
)

xyplot( CO ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
)

xyplot( NO2 ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
)

xyplot( SO2 ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
)

xyplot( O3 ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
)

xyplot( TEMP ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
       
       ylim =c (10,15)
)

xyplot( RAIN ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
       ylim =c (0,0.2)

)

xyplot( PRES ~ weekday  ,
       type="b",
       
       data = grouped_weekday_year,
       auto.key = TRUE,
       ylim =c (900,1100)
       

)

For the air pollutant, Here are some variations among weekdays. For example, Staturday has higher PM2.5, PM10, CO, NO2 concentration.

For the weather conditions, there are not much variation among weekdays. (It is normal because the weather should not by affect by the week time )

Hourly analysis

grouped_hour = aggregate(cbind(PM2.5,PM10,SO2,NO2,CO,O3,TEMP,PRES, DEWP,RAIN,WSPM) ~   hour , data = data, FUN = mean, na.rm = TRUE)

grouped_hour_month = aggregate(cbind(PM2.5,PM10,SO2,NO2,CO,O3,TEMP,PRES, DEWP,RAIN,WSPM) ~   hour + month  , data = data, FUN = mean, na.rm = TRUE)


xyplot( PM2.5 ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
)

xyplot( PM10 ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
)

xyplot( CO ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
)

xyplot( NO2 ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
)

xyplot( SO2 ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
)

xyplot( O3 ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
)

xyplot( TEMP ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
       
       
)

xyplot( RAIN ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
       ylim =c (0,0.2)

)

xyplot( PRES ~ hour  ,
       type="b",
       
       data = grouped_hour,
       auto.key = TRUE,
       ylim =c (900,1100)
       

)

The line plot shows that in average, the PM2.5, PM10, CO ,and NO2 has higher concentration level at night, and less concentration level at day time.

The Temperature increased since the sun raise and Fridge the maximum at the noon, then decreasing form afternoon to the night

Model fitting

fit decomposition models (monthly)

We are going to find the data to two types of decomposition model. One is the additive decomposition. Another is the multiplicative decomposition. First, we will do the additive decomposition.

# additive decomposition
add_decomp_PM25 <- decompose(ts_by_month[,'PM2.5'], type = 'additive')
add_decomp<- decompose(ts_by_month, type = 'additive')
add_decomp_PM25
## $x
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 2013                     106.69892  78.82778  81.71640 105.67153  68.14651
## 2014 113.49194 156.06399  98.66667  86.64444  59.18804  58.03889  85.52151
## 2015 103.28199 102.95833  87.32258  71.85556  55.34543  59.44583  61.57124
## 2016  75.26210  48.35201  95.18952  67.05417  55.25806  64.08889  74.10753
## 2017 132.08333  77.61905                                                  
##            Aug       Sep       Oct       Nov       Dec
## 2013  59.41532  61.74306  98.97849  84.30972  92.30914
## 2014  64.41331  70.99903 114.25806 103.31708  67.94247
## 2015  45.68548  53.15000  77.78226 125.42639 165.81989
## 2016  50.55242  59.25139  83.71640 106.37361 156.83468
## 2017                                                  
## 
## $seasonal
##             Jan        Feb        Mar        Apr        May        Jun
## 2013                        12.596727  -5.698226 -24.380240 -21.655511
## 2014  16.017806  21.170881  12.596727  -5.698226 -24.380240 -21.655511
## 2015  16.017806  21.170881  12.596727  -5.698226 -24.380240 -21.655511
## 2016  16.017806  21.170881  12.596727  -5.698226 -24.380240 -21.655511
## 2017  16.017806  21.170881                                            
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2013  -9.601027 -28.952748 -21.657639  13.707981  21.583772  26.868223
## 2014  -9.601027 -28.952748 -21.657639  13.707981  21.583772  26.868223
## 2015  -9.601027 -28.952748 -21.657639  13.707981  21.583772  26.868223
## 2016  -9.601027 -28.952748 -21.657639  13.707981  21.583772  26.868223
## 2017                                                                  
## 
## $trend
##           Jan      Feb      Mar      Apr      May      Jun      Jul      Aug
## 2013                         NA       NA       NA       NA       NA       NA
## 2014 87.14031 88.07252 88.66643 89.68875 91.11737 90.89406 89.45337 86.81522
## 2015 81.22384 79.44558 77.92155 75.65801 75.05941 80.05886 82.96959 79.52683
## 2016 78.40901 79.13415 79.59116 80.09264 79.54603 78.37778 80.37095 83.95796
## 2017       NA       NA                                                      
##           Sep      Oct      Nov      Dec
## 2013 91.94639 91.93741 91.32442 88.40104
## 2014 84.12981 83.04094 82.26463 82.16314
## 2015 77.57935 77.70708 77.50339 77.69321
## 2016       NA       NA       NA       NA
## 2017                                    
## 
## $random
##               Jan          Feb          Mar          Apr          May
## 2013                                     NA           NA           NA
## 2014  10.33382068  46.82059124  -2.59649089   2.65392485  -7.54908995
## 2015   6.04034552   2.34186903  -3.19569409   1.89576779   4.66626068
## 2016 -19.16472204 -51.95301612   3.00162914  -7.34024848   0.09227343
## 2017           NA           NA                                       
##               Jun          Jul          Aug          Sep          Oct
## 2013           NA           NA           NA  -8.54569396  -6.66689181
## 2014 -11.19966299   5.66916168   6.55083331   8.52685202  17.50914281
## 2015   1.04248834 -11.79732274  -4.88859599  -2.77171390 -13.63280684
## 2016   7.36661881   3.33760522  -4.45279316           NA           NA
## 2017                                                                 
##               Nov          Dec
## 2013 -28.59846862 -22.96012658
## 2014  -0.53131766 -41.08889239
## 2015  26.33923044  61.25846313
## 2016           NA           NA
## 2017                          
## 
## $figure
##  [1]  12.596727  -5.698226 -24.380240 -21.655511  -9.601027 -28.952748
##  [7] -21.657639  13.707981  21.583772  26.868223  16.017806  21.170881
## 
## $type
## [1] "additive"
## 
## attr(,"class")
## [1] "decomposed.ts"

Time series decomposition reduce as four components(Trend,Cycle,Seasonality ,Remainder).

The trend means that the general direction in which the time series is moving.

The cycle is refers to its tendency to rise and fall at inconsistent frequencies.

The seasonal component refers to data that rises and falls at consistent frequencies.

The remainder is means that it exclude trend, cycle, and seasonal components. It is the random fluctuation that cannot explain.

plot(add_decomp_PM25)

In the figure, we can see that the trend overall is declining.The seasonal component reflecting the fundamental changes in the air pollutant(PM2.5) since 2014.

add_decomp
## $x
##              PM2.5      PM10       SO2      NO2        CO        O3
## Mar 2013 106.69892 130.19355 41.782387 63.42723 1563.6962  49.67568
## Apr 2013  78.82778  93.94167 22.014413 42.76404 1000.7417  50.78922
## May 2013  81.71640 129.03360 26.635918 52.47490 1094.1250  71.12242
## Jun 2013 105.67153 118.43681 14.815358 52.75863 1628.0139  69.63165
## Jul 2013  68.14651  73.75403  7.801311 45.31321 1223.7702  84.50378
## Aug 2013  59.41532  81.54301  6.996331 45.75652 1075.8065  86.94474
## Sep 2013  61.74306 117.49028 13.512820 57.73660 1326.5194  49.56147
## Oct 2013  98.97849 133.95833 15.550846 73.50200 1392.0699  28.22625
## Nov 2013  84.30972 111.67361 23.508333 58.00556 1575.4167  19.07793
## Dec 2013  92.30914 121.84812 44.816955 66.48069 2213.8441  12.87716
## Jan 2014 113.49194 152.32863 61.379032 79.61559 2171.3710  12.22043
## Feb 2014 156.06399 176.36310 67.059524 74.99405 2458.0357  18.06548
## Mar 2014  98.66667 157.95161 40.067204 66.39785 1489.1129  47.58333
## Apr 2014  86.64444 141.04306 18.758333 54.85417 1075.8333  68.79861
## May 2014  59.18804 112.96250 14.621640 47.10403  934.5430  92.11142
## Jun 2014  58.03889  81.15000  6.341667 46.40833  990.5556 103.63750
## Jul 2014  85.52151 110.45161  5.244624 40.52151  907.9301 104.85215
## Aug 2014  64.41331  91.18616  4.044624 49.18696 1027.1505  94.55497
## Sep 2014  70.99903  97.71708  5.679167 59.13194 1162.5000  53.78361
## Oct 2014 114.25806 143.46505  8.204301 76.72177 1372.3118  26.74059
## Nov 2014 103.31708 142.29014 14.245139 77.05292 1785.4167  22.32083
## Dec 2014  67.94247 111.75591 33.370027 63.90403 1873.9247  29.50847
## Jan 2015 103.28199 128.48925 39.075672 76.75376 2011.6935  24.22755
## Feb 2015 102.95833 133.78869 29.120536 59.45833 1557.1429  38.70536
## Mar 2015  87.32258 155.15323 23.263441 59.77419 1257.3925  54.28763
## Apr 2015  71.85556 121.17083  9.693056 49.62222  835.8333  78.03472
## May 2015  55.34543  93.78898  9.059140 41.90726  779.1667  98.06855
## Jun 2015  59.44583  81.00139  6.877778 37.44861  865.8333  92.75417
## Jul 2015  61.57124  77.40188  4.935484 38.15995  978.3602  95.05780
## Aug 2015  45.68548  67.98118  3.108871 35.40726  909.6774 100.36694
## Sep 2015  53.15000  68.63472  4.965278 43.25139  956.6667  58.35278
## Oct 2015  77.78226  98.78629  5.424731 55.75672 1043.9516  36.92473
## Nov 2015 125.42639 131.26806 14.548611 60.19444 2085.4167  14.15139
## Dec 2015 165.81989 175.36425 24.176075 73.86290 3024.3280  17.96102
## Jan 2016  75.26210  88.44892 24.372312 52.94892 1639.1129  28.16935
## Feb 2016  48.35201  61.49856 17.149425 34.41810  933.9080  47.92385
## Mar 2016  95.18952 130.83737 20.548387 53.99194 1223.9247  48.20565
## Apr 2016  67.05417 109.42500 11.688889 41.57083  852.0833  72.54167
## May 2016  55.25806  95.65995  9.151882 37.45833  724.3280  99.22043
## Jun 2016  64.08889  82.17778  5.462500 34.99444  865.8333 126.60556
## Jul 2016  74.10753  82.06452  3.322581 34.48925  997.9839  96.86290
## Aug 2016  50.55242  64.67608  2.659946 39.72849  932.6613  76.13575
## Sep 2016  59.25139  70.65417  2.827778 50.75833  870.1389  56.39444
## Oct 2016  83.71640  94.86962  3.310484 61.01210 1246.5054  20.25538
## Nov 2016 106.37361 136.37778 10.468056 71.47778 1812.7778  14.05556
## Dec 2016 156.83468 169.18011 17.418011 89.91532 2604.1667  15.15188
## Jan 2017 132.08333 149.47984 18.594086 71.23522 2254.3011  27.93952
## Feb 2017  77.61905  90.79464 18.520833 56.49405 1173.6607  40.98810
##                  TEMP      PRES        DEWP         RAIN     WSPM
## Mar 2013  6.373252688 1011.6395  -6.3188172 0.0236559140 1.753495
## Apr 2013 12.599166667 1007.2869  -2.8651389 0.0141666667 2.223472
## May 2013 21.787903226 1002.1239   8.4520161 0.0076612903 1.771237
## Jun 2013 23.783055556  999.0772  17.5343056 0.1015277778 1.355000
## Jul 2013 27.156451613  995.0235  21.1831989 0.2802419355 1.359946
## Aug 2013 27.257661290  998.2694  20.0935484 0.0907258065 1.416398
## Sep 2013 20.487361111 1008.3138  14.5504167 0.1150000000 1.160972
## Oct 2013 13.199865591 1015.2367   5.3115591 0.0170698925 1.337366
## Nov 2013  5.880555556 1016.0646  -7.1959722 0.0008333333 1.769028
## Dec 2013 -0.005241935 1019.1534 -13.2763441 0.0000000000 1.699866
## Jan 2014  0.173655914 1019.2828 -12.6904570 0.0000000000 1.618548
## Feb 2014  0.089434524 1021.6240  -9.5802083 0.0098214286 1.438244
## Mar 2014 10.513844086 1012.8694  -5.8724462 0.0001344086 1.810215
## Apr 2014 17.184027778 1009.5782   3.9636111 0.0180555556 1.615556
## May 2014 21.865188172 1000.7228   6.9375000 0.0915322581 2.020027
## Jun 2014 24.901944444  999.3411  16.3420833 0.1980555556 1.393472
## Jul 2014 28.287634409  997.8254  19.5525538 0.0581989247 1.479973
## Aug 2014 26.208736559 1001.8782  18.1295699 0.1381720430 1.395833
## Sep 2014 21.123472222 1007.9142  13.8113889 0.0547222222 1.310833
## Oct 2014 14.044892473 1013.6585   6.2706989 0.0182795699 1.217070
## Nov 2014  6.371111111 1021.8025  -5.1972222 0.0004166667 1.538472
## Dec 2014 -0.226478495 1025.9004 -16.1875000 0.0000000000 2.189113
## Jan 2015 -0.125537634 1020.9488 -13.7850806 0.0005376344 1.604704
## Feb 2015  1.743154762 1017.6015 -12.4601190 0.0168154762 1.811905
## Mar 2015  8.439861751 1016.8734  -9.8809140 0.0088709677 2.213575
## Apr 2015 15.630138889 1010.8733   1.6945833 0.0556944444 2.483056
## May 2015 21.455510753 1003.4489   6.6134409 0.0501344086 2.471102
## Jun 2015 24.537777778 1000.3461  14.3013889 0.1362500000 1.980278
## Jul 2015 26.397849462 1001.2784  18.5057796 0.2701612903 1.627285
## Aug 2015 26.435752688 1003.4042  18.4461022 0.1258064516 1.615457
## Sep 2015 20.600833333 1011.3549  13.7698611 0.1372222222 1.601944
## Oct 2015 14.319758065 1015.7254   4.1530914 0.0190860215 1.848790
## Nov 2015  2.847777778 1023.4250  -1.2023611 0.0522222222 1.548056
## Dec 2015 -0.362768817 1024.0706  -7.2271505 0.0028225806 1.856452
## Jan 2016 -4.550000000 1025.9500 -18.0596774 0.0006720430 2.115054
## Feb 2016  1.398419540 1022.5598 -15.0882184 0.0181034483 2.449138
## Mar 2016  9.201881720 1016.7401  -8.7526882 0.0000000000 2.049866
## Apr 2016 16.454722222 1007.8117  -0.3329167 0.0066666667 2.382361
## May 2016 21.672849462 1005.5414   6.2018817 0.0458333333 2.207796
## Jun 2016 25.735833333 1000.7619  14.6834722 0.0991666667 1.803056
## Jul 2016 27.699462366 1000.6353  20.7272849 0.4233870968 1.698925
## Aug 2016 27.863306452 1003.5901  19.2868280 0.0724462366 1.618414
## Sep 2016 22.197344026 1009.3406  14.0559722 0.1598611111 1.554444
## Oct 2016 13.338648073 1017.1267   7.2780914 0.1174731183 1.476882
## Nov 2016  4.414027778 1020.5669  -3.7584722 0.0073611111 1.557778
## Dec 2016  0.640725806 1023.4661  -9.2724462 0.0000000000 1.435618
## Jan 2017 -1.140412186 1025.0380 -12.7756720 0.0004032258 1.969220
## Feb 2017  2.661532738 1022.0206 -13.6276786 0.0061011905 1.953869
## 
## $seasonal
##             Jan        Feb        Mar        Apr        May        Jun
## 2013                         3.998767 -34.759863 -46.821312 -39.493936
## 2014  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2015  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2016  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2017  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2018  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2019  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2020  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2021  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2022  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2023  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2024  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2025  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2026  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2027  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2028  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2029  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2030  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2031  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2032  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2033  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2034  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2035  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2036  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2037  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2038  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2039  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2040  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2041  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2042  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2043  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2044  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2045  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2046  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2047  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2048  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2049  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2050  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2051  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2052  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2053  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2054  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2055  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2056  55.312609  29.866751   3.998767 -34.759863 -46.821312 -39.493936
## 2057  55.312609  29.866751                                            
##             Jul        Aug        Sep        Oct        Nov        Dec
## 2013 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2014 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2015 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2016 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2017 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2018 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2019 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2020 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2021 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2022 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2023 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2024 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2025 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2026 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2027 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2028 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2029 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2030 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2031 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2032 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2033 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2034 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2035 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2036 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2037 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2038 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2039 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2040 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2041 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2042 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2043 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2044 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2045 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2046 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2047 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2048 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2049 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2050 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2051 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2052 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2053 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2054 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2055 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2056 -33.856298 -36.175662 -24.854130  -8.723305  40.661334  94.845043
## 2057                                                                  
## 
## $trend
##              [,1]      [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
## Mar 2013       NA        NA       NA       NA       NA       NA       NA
## Apr 2013       NA        NA       NA       NA       NA       NA       NA
## May 2013       NA        NA       NA       NA       NA       NA       NA
## Jun 2013       NA        NA       NA       NA       NA       NA       NA
## Jul 2013       NA        NA       NA       NA       NA       NA       NA
## Aug 2013       NA        NA       NA       NA       NA       NA       NA
## Sep 2013 91.94639 121.20365 28.75130 59.52619 1557.177 45.97084 13.40445
## Oct 2013 91.93741 124.32279 28.54417 60.15372 1557.198 46.63405 13.76801
## Nov 2013 91.32442 125.61572 27.90790 60.43369 1553.677 48.25898 13.96227
## Dec 2013 88.40104 123.39247 27.05424 59.94531 1520.467 50.55043 14.01211
## Jan 2014 87.14031 123.36792 26.59464 59.48106 1480.747 52.81519 14.10586
## Feb 2014 88.07252 125.29879 26.36512 59.42434 1465.559 53.98013 14.10929
## Mar 2014 88.66643 124.87670 25.91573 59.62542 1456.698 54.47315 14.09209
## Apr 2014 89.68875 124.44893 25.28322 59.81771 1449.040 54.58717 14.15380
## May 2014 91.11737 126.12073 24.59115 60.74551 1456.967 54.66039 14.20945
## Jun 2014 90.89406 126.97591 23.72823 61.43179 1451.554 55.48848 14.22067
## Jul 2014 89.45337 125.56210 22.32197 61.20519 1430.737 56.68175 14.19899
## Aug 2014 86.81522 122.79486 19.81187 60.43862 1386.547 58.04204 14.25543
## Sep 2014 84.12981 120.90432 17.53092 59.51532 1339.355 59.18138 14.23792
## Oct 2014 83.04094 119.95971 16.45304 59.02133 1319.700 59.84556 14.08676
## Nov 2014 82.26463 118.33281 15.84355 58.58680 1303.226 60.47862 14.00494
## Dec 2014 82.16314 117.52772 15.63412 57.99695 1291.555 60.27336 13.97270
## Jan 2015 81.22384 116.14445 15.64358 57.52523 1289.293 59.41179 13.87878
## Feb 2015 79.44558 113.80051 15.59171 56.85268 1287.332 59.24585 13.80950
## Mar 2015 77.92155 111.62187 15.52297 55.61683 1273.861 59.67840 13.79718
## Apr 2015 75.65801 108.54849 15.37741 54.08160 1251.603 60.29312 13.78686
## May 2015 75.05941 106.22762 15.27424 52.50562 1250.422 60.37707 13.65151
## Jun 2015 80.05886 108.41871 14.90380 52.21813 1310.855 59.55553 13.49902
## Jul 2015 82.96959 109.40072 13.90808 51.64122 1343.264 59.23863 13.30899
## Aug 2015 79.52683 104.72028 12.79665 49.60601 1301.772 59.78697 13.11027
## Sep 2015 77.57935 100.69503 12.18472 48.32174 1274.409 59.91766 13.12766
## Oct 2015 77.70708  99.19246 12.15476 47.74534 1273.692 59.43537 13.19377
## Nov 2015 77.50339  98.78101 12.24178 47.22449 1272.084 59.25449 13.23718
## Dec 2015 77.69321  98.90798 12.18667 46.93686 1269.799 60.71295 13.29616
## Jan 2016 78.40901  99.15127 12.06050 46.68166 1270.617 62.19864 13.40031
## Feb 2016 79.13415  99.20784 11.97459 46.70876 1272.392 61.26422 13.51402
## Mar 2016 79.59116  99.15427 11.86682 47.20160 1269.745 60.17299 13.64003
## Apr 2016 80.09264  99.07522 11.68967 47.73337 1274.579 59.39684 13.66567
## May 2016 79.54603  99.12493 11.43155 48.42248 1271.659 58.69829 13.69005
## Jun 2016 78.37778  99.08016 10.97994 49.56147 1242.792 58.57725 13.79712
## Jul 2016 80.37095 101.36544 10.45759 50.99225 1250.918 58.45062 13.98100
## Aug 2016 83.95796 105.12907 10.27398 52.67401 1286.541 58.15206 14.17570
## Sep 2016       NA        NA       NA       NA       NA       NA       NA
## Oct 2016       NA        NA       NA       NA       NA       NA       NA
## Nov 2016       NA        NA       NA       NA       NA       NA       NA
## Dec 2016       NA        NA       NA       NA       NA       NA       NA
## Jan 2017       NA        NA       NA       NA       NA       NA       NA
## Feb 2017       NA        NA       NA       NA       NA       NA       NA
##              [,8]     [,9]      [,10]    [,11]
## Mar 2013       NA       NA         NA       NA
## Apr 2013       NA       NA         NA       NA
## May 2013       NA       NA         NA       NA
## Jun 2013       NA       NA         NA       NA
## Jul 2013       NA       NA         NA       NA
## Aug 2013       NA       NA         NA       NA
## Sep 2013 1009.476 2.951774 0.05407861 1.577661
## Oct 2013 1009.623 3.254904 0.05326058 1.554694
## Nov 2013 1009.660 3.476331 0.05691724 1.539731
## Dec 2013 1009.612 3.363550 0.06443386 1.551700
## Jan 2014 1009.740 3.245931 0.05920406 1.558304
## Feb 2014 1010.007 3.096155 0.05192919 1.562449
## Mar 2014 1010.141 2.983529 0.05139454 1.567836
## Apr 2014 1010.058 2.992701 0.04893337 1.569068
## May 2014 1010.232 3.115946 0.04896641 1.554449
## Jun 2014 1010.752 3.077929 0.04894905 1.565228
## Jul 2014 1011.103 2.911022 0.04897145 1.585036
## Aug 2014 1011.004 2.745416 0.04928527 1.600029
## Sep 2014 1011.004 2.458400 0.04994072 1.632404
## Oct 2014 1011.224 2.196838 0.05187303 1.685357
## Nov 2014 1011.392 2.088793 0.05171640 1.740298
## Dec 2014 1011.547 1.990261 0.04741626 1.783543
## Jan 2015 1011.733 1.861617 0.05367280 1.814131
## Feb 2015 1011.941 1.831190 0.06198933 1.829420
## Mar 2015 1012.148 1.842649 0.06491159 1.850700
## Apr 2015 1012.377 1.752685 0.06838270 1.889152
## May 2015 1012.531 1.830903 0.07057486 1.915873
## Jun 2015 1012.522 2.370704 0.07285104 1.902411
## Jul 2015 1012.654 2.565944 0.07297424 1.909815
## Aug 2015 1013.069 2.278331 0.07303351 1.957631
## Sep 2015 1013.270 2.215837 0.07271755 1.977361
## Oct 2015 1013.137 2.178367 0.07030510 1.966344
## Nov 2015 1013.097 2.076739 0.06808307 1.951177
## Dec 2015 1013.201 2.075511 0.06635872 1.932822
## Jan 2016 1013.192 2.183994 0.07119799 1.928423
## Feb 2016 1013.173 2.311587 0.07535905 1.931531
## Mar 2016 1013.097 2.358539 0.07407900 1.929675
## Apr 2016 1013.071 2.500668 0.07912175 1.912200
## May 2016 1013.010 2.524372 0.08135200 1.897109
## Jun 2016 1012.866 2.332647 0.07936518 1.879979
## Jul 2016 1012.803 2.467593 0.07923637 1.856368
## Aug 2016 1012.742 2.748616 0.07872507 1.829655
## Sep 2016       NA       NA         NA       NA
## Oct 2016       NA       NA         NA       NA
## Nov 2016       NA       NA         NA       NA
## Dec 2016       NA       NA         NA       NA
## Jan 2017       NA       NA         NA       NA
## Feb 2017       NA       NA         NA       NA
## 
## $random
##          x - seasonal.x.PM2.5 x - seasonal.x.PM10 x - seasonal.x.SO2
## Mar 2013                   NA                  NA                 NA
## Apr 2013                   NA                  NA                 NA
## May 2013                   NA                  NA                 NA
## Jun 2013                   NA                  NA                 NA
## Jul 2013                   NA                  NA                 NA
## Aug 2013                   NA                  NA                 NA
## Sep 2013            -5.349203          21.1407608          9.6156468
## Oct 2013            15.764394          18.3588480         -4.2700155
## Nov 2013           -47.676030         -54.6034424        -45.0609031
## Dec 2013           -90.936947         -96.3893983        -77.0823253
## Jan 2014           -28.960982         -26.3519018        -20.5282141
## Feb 2014            38.124721          21.1975582         10.8276512
## Mar 2014             6.001469          29.0761455         10.1527061
## Apr 2014            31.715562          51.3539876         28.2349730
## May 2014            14.891982          33.6630789         36.8518008
## Jun 2014             6.638761          -6.3319773         22.1073734
## Jul 2014            29.924432          18.7458137         16.7789545
## Aug 2014            13.773747           4.5669619         20.4084164
## Sep 2014            11.723343           1.6668906         13.0023757
## Oct 2014            39.940429          32.2286453          0.4745623
## Nov 2014           -19.608879         -16.7040032        -42.2597487
## Dec 2014          -109.065713        -100.6168484        -77.1091370
## Jan 2015           -33.254457         -42.9678161        -31.8805143
## Feb 2015            -6.354002          -9.8785696        -16.3379228
## Mar 2015             5.402266          39.5325890          3.7417018
## Apr 2015            30.957405          47.3822063         29.0755069
## May 2015            27.107332          34.3826690         40.6062107
## Jun 2015            18.880913          12.0766096         31.4679093
## Jul 2015            12.457948           1.8574640         24.8836988
## Aug 2015             2.334318          -0.5634354         26.4878862
## Sep 2015             0.424777          -7.2061782         17.6346848
## Oct 2015             8.798479           8.3171360          1.9932813
## Nov 2015             7.261669          -8.1742857        -38.3545024
## Dec 2015            -6.718357         -18.3887762        -82.8556417
## Jan 2016           -58.459524         -66.0149568        -43.0007962
## Feb 2016           -60.648887         -67.5760246        -24.6919160
## Mar 2016            11.599589          27.6843314          4.6827979
## Apr 2016            21.721389          45.1096464         34.7590854
## May 2016            22.533345          43.3563308         44.5416439
## Jun 2016            25.205043          22.5915538         33.9764954
## Jul 2016            27.592876          14.5553719         26.7212835
## Aug 2016             2.770121          -4.2773296         28.5616305
## Sep 2016                   NA                  NA                 NA
## Oct 2016                   NA                  NA                 NA
## Nov 2016                   NA                  NA                 NA
## Dec 2016                   NA                  NA                 NA
## Jan 2017                   NA                  NA                 NA
## Feb 2017                   NA                  NA                 NA
##          x - seasonal.x.NO2 x - seasonal.x.CO x - seasonal.x.O3
## Mar 2013                 NA                NA                NA
## Apr 2013                 NA                NA                NA
## May 2013                 NA                NA                NA
## Jun 2013                 NA                NA                NA
## Jul 2013                 NA                NA                NA
## Aug 2013                 NA                NA                NA
## Sep 2013         23.0645354        -205.80297         28.444759
## Oct 2013         22.0715805        -156.40453         -9.684491
## Nov 2013        -43.0894713         -18.92196        -69.842382
## Dec 2013        -88.3096672         598.53176       -132.518312
## Jan 2014        -35.1780781         635.31185        -95.907370
## Feb 2014        -14.2970456         962.60978        -65.781408
## Mar 2014          2.7736658          28.41643        -10.888582
## Apr 2014         29.7963159        -338.44712         48.971305
## May 2014         33.1798330        -475.60274         84.272349
## Jun 2014         24.4704786        -421.50426         87.642956
## Jul 2014         13.1726161        -488.95082         82.026701
## Aug 2014         24.9240014        -323.22059         72.688596
## Sep 2014         24.4707589        -152.00044         19.456361
## Oct 2014         26.4237475          61.33558        -24.381667
## Nov 2014        -22.1952197         441.52979        -78.819116
## Dec 2014        -88.9379592         487.52492       -125.609932
## Jan 2015        -36.0840733         667.08835        -90.496841
## Feb 2015        -27.2610934         239.94364        -50.407247
## Mar 2015          0.1585953         -20.46766         -9.389533
## Apr 2015         30.3004873        -381.01011         52.501464
## May 2015         36.2229523        -424.43365         84.512793
## Jun 2015         24.7244127        -405.52783         72.692573
## Jul 2015         20.3750252        -331.04786         69.675465
## Aug 2015         21.9769122        -355.91898         76.755624
## Sep 2015         19.7837817        -292.88866         23.289247
## Oct 2015         16.7346907        -221.01713        -13.787331
## Nov 2015        -27.6913785         772.67115        -85.764431
## Dec 2015        -67.9190000        1659.68368       -137.596977
## Jan 2016        -49.0453411         313.18341        -89.341896
## Feb 2016        -42.1574108        -368.35091        -43.207123
## Mar 2016          2.7915647         -49.81858        -15.966114
## Apr 2016         28.5973288        -387.73576         47.904690
## May 2016         35.8571648        -500.50947         87.343452
## Jun 2016         24.9269102        -337.46480        107.522242
## Jul 2016         17.3532955        -219.07802         72.268576
## Aug 2016         23.2301471        -317.70377         54.159356
## Sep 2016                 NA                NA                NA
## Oct 2016                 NA                NA                NA
## Nov 2016                 NA                NA                NA
## Dec 2016                 NA                NA                NA
## Jan 2017                 NA                NA                NA
## Feb 2017                 NA                NA                NA
##          x - seasonal.x.TEMP x - seasonal.x.PRES x - seasonal.x.DEWP
## Mar 2013                  NA                  NA                  NA
## Apr 2013                  NA                  NA                  NA
## May 2013                  NA                  NA                  NA
## Jun 2013                  NA                  NA                  NA
## Jul 2013                  NA                  NA                  NA
## Aug 2013                  NA                  NA                  NA
## Sep 2013           31.937040          23.6920012            36.45277
## Oct 2013            8.155159          14.3374083            10.77996
## Nov 2013          -48.743047         -34.2564322           -51.33364
## Dec 2013         -108.862394         -85.3039816          -111.48494
## Jan 2014          -69.244814         -45.7698519           -71.24900
## Feb 2014          -43.886606         -18.2499467           -42.54311
## Mar 2014           -7.577011          -1.2702862           -12.85474
## Apr 2014           37.790088          34.2795918            35.73077
## May 2014           54.477048          37.3123752            50.64287
## Jun 2014           50.175207          28.0830542            52.75809
## Jul 2014           47.944943          20.5791651            50.49783
## Aug 2014           48.128971          27.0495383            51.55982
## Sep 2014           31.739686          21.7647147            36.20712
## Oct 2014            8.681443          11.1573916            12.79717
## Nov 2014          -48.295163         -30.2507663           -47.94735
## Dec 2014         -109.044218         -80.4920337          -113.02280
## Jan 2015          -69.316928         -46.0969601           -70.95931
## Feb 2015          -41.933096         -24.2058591           -44.15806
## Mar 2015           -9.356087           0.7271035           -15.72233
## Apr 2015           36.603143          33.2561724            34.70176
## May 2015           54.625317          37.7394862            51.60385
## Jun 2015           50.532692          27.3179356            51.42462
## Jul 2015           46.945157          22.4804063            49.79613
## Aug 2015           49.501141          26.5105980            52.34343
## Sep 2015           32.327303          22.9387221            36.40815
## Oct 2015            9.849295          11.3115657            10.69803
## Nov 2015          -51.050738         -30.3330940           -43.94043
## Dec 2015         -108.503969         -83.9757514          -104.14771
## Jan 2016          -73.262918         -42.5544155           -75.55628
## Feb 2016          -41.982357         -20.4797413           -47.26656
## Mar 2016           -8.436913          -0.3552892           -15.10999
## Apr 2016           37.548916          29.5004957            31.92628
## May 2016           54.804111          39.3523744            50.49882
## Jun 2016           51.432646          27.3898155            51.84476
## Jul 2016           47.574759          21.6887686            52.11599
## Aug 2016           49.863271          27.0233042            52.71387
## Sep 2016                  NA                  NA                  NA
## Oct 2016                  NA                  NA                  NA
## Nov 2016                  NA                  NA                  NA
## Dec 2016                  NA                  NA                  NA
## Jan 2017                  NA                  NA                  NA
## Feb 2017                  NA                  NA                  NA
##          x - seasonal.x.RAIN x - seasonal.x.WSPM
## Mar 2013                  NA                  NA
## Apr 2013                  NA                  NA
## May 2013                  NA                  NA
## Jun 2013                  NA                  NA
## Jul 2013                  NA                  NA
## Aug 2013                  NA                  NA
## Sep 2013           24.915051           24.437441
## Oct 2013            8.687115            8.505977
## Nov 2013          -40.717418          -40.432037
## Dec 2013          -94.909477          -94.696878
## Jan 2014          -55.371813          -55.252364
## Feb 2014          -29.908859          -29.990956
## Mar 2014           -4.050027           -3.756388
## Apr 2014           34.728985           34.806350
## May 2014           46.863877           47.286889
## Jun 2014           39.643042           39.322180
## Jul 2014           33.865525           33.751234
## Aug 2014           36.264548           35.971466
## Sep 2014           24.858911           24.532559
## Oct 2014            8.689712            8.255018
## Nov 2014          -40.712634          -40.863160
## Dec 2014          -94.892460          -94.439473
## Jan 2015          -55.365744          -55.522035
## Feb 2015          -29.911925          -29.884266
## Mar 2015           -4.054808           -3.635892
## Apr 2015           34.747174           35.353766
## May 2015           46.800871           47.376541
## Jun 2015           39.557334           39.571802
## Jul 2015           34.053485           33.573768
## Aug 2015           36.228435           35.833488
## Sep 2015           24.918635           24.478713
## Oct 2015            8.672086            8.605752
## Nov 2015          -40.677195          -41.064456
## Dec 2015          -94.908579          -94.921414
## Jan 2016          -55.383135          -55.125978
## Feb 2016          -29.924007          -29.349144
## Mar 2016           -4.072846           -3.878576
## Apr 2016           34.687408           35.230024
## May 2016           46.785793           47.131999
## Jun 2016           39.513737           39.417012
## Jul 2016           34.200448           33.698854
## Aug 2016           36.169383           35.964420
## Sep 2016                  NA                  NA
## Oct 2016                  NA                  NA
## Nov 2016                  NA                  NA
## Dec 2016                  NA                  NA
## Jan 2017                  NA                  NA
## Feb 2017                  NA                  NA
## 
## $figure
##  [1]   3.998767 -34.759863 -46.821312 -39.493936 -33.856298 -36.175662
##  [7] -24.854130  -8.723305  40.661334  94.845043  55.312609  29.866751
## 
## $type
## [1] "additive"
## 
## attr(,"class")
## [1] "decomposed.ts"

We can observe the fundamental changes of different air pollutants and weather conditions in 2014 to 2017.

plot(add_decomp$x[,1:6])

plot(add_decomp$x[,7:11])

We also check the fundamental changes in the four components(Trend,Cycle,Seasonality ,Remainder) in 2014 to 2017.

For example, in seasonal, we can check that is the fundamental changes similar in different seasons. And we found that there are similar pattern in the figure in different period.

Moreover, in the trend, we can check the general direction in the time series in 2014 to 2017. For example, we found that the trend of SO2 shows a remarkable decline since 2014.

plot(add_decomp$seasonal[1:60], type = "l")

plot(add_decomp$trend[,1:6])

plot(add_decomp$trend[,7:11])

plot(add_decomp$random[,1:6])

plot(add_decomp$random[,7:11])

multiplicative decomposition

Second, we will do the multiplicative decomposition.

multi_decomp_PM25 <- decompose(ts_by_month[,'PM2.5'], type = 'multiplicative')
multi_decomp <- decompose(ts_by_month, type = 'multiplicative')
multi_decomp_PM25
## $x
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 2013                     106.69892  78.82778  81.71640 105.67153  68.14651
## 2014 113.49194 156.06399  98.66667  86.64444  59.18804  58.03889  85.52151
## 2015 103.28199 102.95833  87.32258  71.85556  55.34543  59.44583  61.57124
## 2016  75.26210  48.35201  95.18952  67.05417  55.25806  64.08889  74.10753
## 2017 132.08333  77.61905                                                  
##            Aug       Sep       Oct       Nov       Dec
## 2013  59.41532  61.74306  98.97849  84.30972  92.30914
## 2014  64.41331  70.99903 114.25806 103.31708  67.94247
## 2015  45.68548  53.15000  77.78226 125.42639 165.81989
## 2016  50.55242  59.25139  83.71640 106.37361 156.83468
## 2017                                                  
## 
## $seasonal
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 2013                     1.1536745 0.9261272 0.7002633 0.7396729 0.8814532
## 2014 1.1888050 1.2376261 1.1536745 0.9261272 0.7002633 0.7396729 0.8814532
## 2015 1.1888050 1.2376261 1.1536745 0.9261272 0.7002633 0.7396729 0.8814532
## 2016 1.1888050 1.2376261 1.1536745 0.9261272 0.7002633 0.7396729 0.8814532
## 2017 1.1888050 1.2376261                                                  
##            Aug       Sep       Oct       Nov       Dec
## 2013 0.6454082 0.7402740 1.1617698 1.2774791 1.3474468
## 2014 0.6454082 0.7402740 1.1617698 1.2774791 1.3474468
## 2015 0.6454082 0.7402740 1.1617698 1.2774791 1.3474468
## 2016 0.6454082 0.7402740 1.1617698 1.2774791 1.3474468
## 2017                                                  
## 
## $trend
##           Jan      Feb      Mar      Apr      May      Jun      Jul      Aug
## 2013                         NA       NA       NA       NA       NA       NA
## 2014 87.14031 88.07252 88.66643 89.68875 91.11737 90.89406 89.45337 86.81522
## 2015 81.22384 79.44558 77.92155 75.65801 75.05941 80.05886 82.96959 79.52683
## 2016 78.40901 79.13415 79.59116 80.09264 79.54603 78.37778 80.37095 83.95796
## 2017       NA       NA                                                      
##           Sep      Oct      Nov      Dec
## 2013 91.94639 91.93741 91.32442 88.40104
## 2014 84.12981 83.04094 82.26463 82.16314
## 2015 77.57935 77.70708 77.50339 77.69321
## 2016       NA       NA       NA       NA
## 2017                                    
## 
## $random
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 2013                            NA        NA        NA        NA        NA
## 2014 1.0955578 1.4317686 0.9645571 1.0431149 0.9276228 0.8632645 1.0846244
## 2015 1.0696223 1.0471341 0.9713723 1.0254979 1.0529682 1.0038581 0.8418984
## 2016 0.8074204 0.4936978 1.0366711 0.9039877 0.9920094 1.1054779 1.0460777
## 2017        NA        NA                                                  
##            Aug       Sep       Oct       Nov       Dec
## 2013        NA 0.9071121 0.9266773 0.7226649 0.7749536
## 2014 1.1495959 1.1400135 1.1843349 0.9831170 0.6136951
## 2015 0.8900821 0.9254749 0.8615884 1.2668186 1.5839518
## 2016 0.9329225        NA        NA        NA        NA
## 2017                                                  
## 
## $figure
##  [1] 1.1536745 0.9261272 0.7002633 0.7396729 0.8814532 0.6454082 0.7402740
##  [8] 1.1617698 1.2774791 1.3474468 1.1888050 1.2376261
## 
## $type
## [1] "multiplicative"
## 
## attr(,"class")
## [1] "decomposed.ts"

We simply check the four components

plot(multi_decomp_PM25)

multi_decomp
## $x
##              PM2.5      PM10       SO2      NO2        CO        O3
## Mar 2013 106.69892 130.19355 41.782387 63.42723 1563.6962  49.67568
## Apr 2013  78.82778  93.94167 22.014413 42.76404 1000.7417  50.78922
## May 2013  81.71640 129.03360 26.635918 52.47490 1094.1250  71.12242
## Jun 2013 105.67153 118.43681 14.815358 52.75863 1628.0139  69.63165
## Jul 2013  68.14651  73.75403  7.801311 45.31321 1223.7702  84.50378
## Aug 2013  59.41532  81.54301  6.996331 45.75652 1075.8065  86.94474
## Sep 2013  61.74306 117.49028 13.512820 57.73660 1326.5194  49.56147
## Oct 2013  98.97849 133.95833 15.550846 73.50200 1392.0699  28.22625
## Nov 2013  84.30972 111.67361 23.508333 58.00556 1575.4167  19.07793
## Dec 2013  92.30914 121.84812 44.816955 66.48069 2213.8441  12.87716
## Jan 2014 113.49194 152.32863 61.379032 79.61559 2171.3710  12.22043
## Feb 2014 156.06399 176.36310 67.059524 74.99405 2458.0357  18.06548
## Mar 2014  98.66667 157.95161 40.067204 66.39785 1489.1129  47.58333
## Apr 2014  86.64444 141.04306 18.758333 54.85417 1075.8333  68.79861
## May 2014  59.18804 112.96250 14.621640 47.10403  934.5430  92.11142
## Jun 2014  58.03889  81.15000  6.341667 46.40833  990.5556 103.63750
## Jul 2014  85.52151 110.45161  5.244624 40.52151  907.9301 104.85215
## Aug 2014  64.41331  91.18616  4.044624 49.18696 1027.1505  94.55497
## Sep 2014  70.99903  97.71708  5.679167 59.13194 1162.5000  53.78361
## Oct 2014 114.25806 143.46505  8.204301 76.72177 1372.3118  26.74059
## Nov 2014 103.31708 142.29014 14.245139 77.05292 1785.4167  22.32083
## Dec 2014  67.94247 111.75591 33.370027 63.90403 1873.9247  29.50847
## Jan 2015 103.28199 128.48925 39.075672 76.75376 2011.6935  24.22755
## Feb 2015 102.95833 133.78869 29.120536 59.45833 1557.1429  38.70536
## Mar 2015  87.32258 155.15323 23.263441 59.77419 1257.3925  54.28763
## Apr 2015  71.85556 121.17083  9.693056 49.62222  835.8333  78.03472
## May 2015  55.34543  93.78898  9.059140 41.90726  779.1667  98.06855
## Jun 2015  59.44583  81.00139  6.877778 37.44861  865.8333  92.75417
## Jul 2015  61.57124  77.40188  4.935484 38.15995  978.3602  95.05780
## Aug 2015  45.68548  67.98118  3.108871 35.40726  909.6774 100.36694
## Sep 2015  53.15000  68.63472  4.965278 43.25139  956.6667  58.35278
## Oct 2015  77.78226  98.78629  5.424731 55.75672 1043.9516  36.92473
## Nov 2015 125.42639 131.26806 14.548611 60.19444 2085.4167  14.15139
## Dec 2015 165.81989 175.36425 24.176075 73.86290 3024.3280  17.96102
## Jan 2016  75.26210  88.44892 24.372312 52.94892 1639.1129  28.16935
## Feb 2016  48.35201  61.49856 17.149425 34.41810  933.9080  47.92385
## Mar 2016  95.18952 130.83737 20.548387 53.99194 1223.9247  48.20565
## Apr 2016  67.05417 109.42500 11.688889 41.57083  852.0833  72.54167
## May 2016  55.25806  95.65995  9.151882 37.45833  724.3280  99.22043
## Jun 2016  64.08889  82.17778  5.462500 34.99444  865.8333 126.60556
## Jul 2016  74.10753  82.06452  3.322581 34.48925  997.9839  96.86290
## Aug 2016  50.55242  64.67608  2.659946 39.72849  932.6613  76.13575
## Sep 2016  59.25139  70.65417  2.827778 50.75833  870.1389  56.39444
## Oct 2016  83.71640  94.86962  3.310484 61.01210 1246.5054  20.25538
## Nov 2016 106.37361 136.37778 10.468056 71.47778 1812.7778  14.05556
## Dec 2016 156.83468 169.18011 17.418011 89.91532 2604.1667  15.15188
## Jan 2017 132.08333 149.47984 18.594086 71.23522 2254.3011  27.93952
## Feb 2017  77.61905  90.79464 18.520833 56.49405 1173.6607  40.98810
##                  TEMP      PRES        DEWP         RAIN     WSPM
## Mar 2013  6.373252688 1011.6395  -6.3188172 0.0236559140 1.753495
## Apr 2013 12.599166667 1007.2869  -2.8651389 0.0141666667 2.223472
## May 2013 21.787903226 1002.1239   8.4520161 0.0076612903 1.771237
## Jun 2013 23.783055556  999.0772  17.5343056 0.1015277778 1.355000
## Jul 2013 27.156451613  995.0235  21.1831989 0.2802419355 1.359946
## Aug 2013 27.257661290  998.2694  20.0935484 0.0907258065 1.416398
## Sep 2013 20.487361111 1008.3138  14.5504167 0.1150000000 1.160972
## Oct 2013 13.199865591 1015.2367   5.3115591 0.0170698925 1.337366
## Nov 2013  5.880555556 1016.0646  -7.1959722 0.0008333333 1.769028
## Dec 2013 -0.005241935 1019.1534 -13.2763441 0.0000000000 1.699866
## Jan 2014  0.173655914 1019.2828 -12.6904570 0.0000000000 1.618548
## Feb 2014  0.089434524 1021.6240  -9.5802083 0.0098214286 1.438244
## Mar 2014 10.513844086 1012.8694  -5.8724462 0.0001344086 1.810215
## Apr 2014 17.184027778 1009.5782   3.9636111 0.0180555556 1.615556
## May 2014 21.865188172 1000.7228   6.9375000 0.0915322581 2.020027
## Jun 2014 24.901944444  999.3411  16.3420833 0.1980555556 1.393472
## Jul 2014 28.287634409  997.8254  19.5525538 0.0581989247 1.479973
## Aug 2014 26.208736559 1001.8782  18.1295699 0.1381720430 1.395833
## Sep 2014 21.123472222 1007.9142  13.8113889 0.0547222222 1.310833
## Oct 2014 14.044892473 1013.6585   6.2706989 0.0182795699 1.217070
## Nov 2014  6.371111111 1021.8025  -5.1972222 0.0004166667 1.538472
## Dec 2014 -0.226478495 1025.9004 -16.1875000 0.0000000000 2.189113
## Jan 2015 -0.125537634 1020.9488 -13.7850806 0.0005376344 1.604704
## Feb 2015  1.743154762 1017.6015 -12.4601190 0.0168154762 1.811905
## Mar 2015  8.439861751 1016.8734  -9.8809140 0.0088709677 2.213575
## Apr 2015 15.630138889 1010.8733   1.6945833 0.0556944444 2.483056
## May 2015 21.455510753 1003.4489   6.6134409 0.0501344086 2.471102
## Jun 2015 24.537777778 1000.3461  14.3013889 0.1362500000 1.980278
## Jul 2015 26.397849462 1001.2784  18.5057796 0.2701612903 1.627285
## Aug 2015 26.435752688 1003.4042  18.4461022 0.1258064516 1.615457
## Sep 2015 20.600833333 1011.3549  13.7698611 0.1372222222 1.601944
## Oct 2015 14.319758065 1015.7254   4.1530914 0.0190860215 1.848790
## Nov 2015  2.847777778 1023.4250  -1.2023611 0.0522222222 1.548056
## Dec 2015 -0.362768817 1024.0706  -7.2271505 0.0028225806 1.856452
## Jan 2016 -4.550000000 1025.9500 -18.0596774 0.0006720430 2.115054
## Feb 2016  1.398419540 1022.5598 -15.0882184 0.0181034483 2.449138
## Mar 2016  9.201881720 1016.7401  -8.7526882 0.0000000000 2.049866
## Apr 2016 16.454722222 1007.8117  -0.3329167 0.0066666667 2.382361
## May 2016 21.672849462 1005.5414   6.2018817 0.0458333333 2.207796
## Jun 2016 25.735833333 1000.7619  14.6834722 0.0991666667 1.803056
## Jul 2016 27.699462366 1000.6353  20.7272849 0.4233870968 1.698925
## Aug 2016 27.863306452 1003.5901  19.2868280 0.0724462366 1.618414
## Sep 2016 22.197344026 1009.3406  14.0559722 0.1598611111 1.554444
## Oct 2016 13.338648073 1017.1267   7.2780914 0.1174731183 1.476882
## Nov 2016  4.414027778 1020.5669  -3.7584722 0.0073611111 1.557778
## Dec 2016  0.640725806 1023.4661  -9.2724462 0.0000000000 1.435618
## Jan 2017 -1.140412186 1025.0380 -12.7756720 0.0004032258 1.969220
## Feb 2017  2.661532738 1022.0206 -13.6276786 0.0061011905 1.953869
## 
## $seasonal
##            Jan       Feb       Mar       Apr       May       Jun       Jul
## 2013                     0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2014 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2015 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2016 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2017 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2018 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2019 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2020 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2021 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2022 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2023 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2024 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2025 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2026 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2027 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2028 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2029 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2030 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2031 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2032 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2033 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2034 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2035 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2036 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2037 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2038 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2039 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2040 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2041 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2042 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2043 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2044 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2045 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2046 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2047 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2048 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2049 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2050 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2051 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2052 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2053 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2054 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2055 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2056 0.2785447 0.3692298 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973
## 2057 0.2785447 0.3692298                                                  
##            Aug       Sep       Oct       Nov       Dec
## 2013 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2014 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2015 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2016 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2017 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2018 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2019 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2020 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2021 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2022 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2023 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2024 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2025 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2026 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2027 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2028 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2029 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2030 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2031 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2032 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2033 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2034 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2035 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2036 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2037 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2038 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2039 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2040 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2041 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2042 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2043 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2044 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2045 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2046 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2047 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2048 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2049 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2050 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2051 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2052 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2053 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2054 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2055 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2056 1.6237867 1.4283454 1.0022651 0.6628109 0.4463759
## 2057                                                  
## 
## $trend
##              [,1]      [,2]     [,3]     [,4]     [,5]     [,6]     [,7]
## Mar 2013       NA        NA       NA       NA       NA       NA       NA
## Apr 2013       NA        NA       NA       NA       NA       NA       NA
## May 2013       NA        NA       NA       NA       NA       NA       NA
## Jun 2013       NA        NA       NA       NA       NA       NA       NA
## Jul 2013       NA        NA       NA       NA       NA       NA       NA
## Aug 2013       NA        NA       NA       NA       NA       NA       NA
## Sep 2013 91.94639 121.20365 28.75130 59.52619 1557.177 45.97084 13.40445
## Oct 2013 91.93741 124.32279 28.54417 60.15372 1557.198 46.63405 13.76801
## Nov 2013 91.32442 125.61572 27.90790 60.43369 1553.677 48.25898 13.96227
## Dec 2013 88.40104 123.39247 27.05424 59.94531 1520.467 50.55043 14.01211
## Jan 2014 87.14031 123.36792 26.59464 59.48106 1480.747 52.81519 14.10586
## Feb 2014 88.07252 125.29879 26.36512 59.42434 1465.559 53.98013 14.10929
## Mar 2014 88.66643 124.87670 25.91573 59.62542 1456.698 54.47315 14.09209
## Apr 2014 89.68875 124.44893 25.28322 59.81771 1449.040 54.58717 14.15380
## May 2014 91.11737 126.12073 24.59115 60.74551 1456.967 54.66039 14.20945
## Jun 2014 90.89406 126.97591 23.72823 61.43179 1451.554 55.48848 14.22067
## Jul 2014 89.45337 125.56210 22.32197 61.20519 1430.737 56.68175 14.19899
## Aug 2014 86.81522 122.79486 19.81187 60.43862 1386.547 58.04204 14.25543
## Sep 2014 84.12981 120.90432 17.53092 59.51532 1339.355 59.18138 14.23792
## Oct 2014 83.04094 119.95971 16.45304 59.02133 1319.700 59.84556 14.08676
## Nov 2014 82.26463 118.33281 15.84355 58.58680 1303.226 60.47862 14.00494
## Dec 2014 82.16314 117.52772 15.63412 57.99695 1291.555 60.27336 13.97270
## Jan 2015 81.22384 116.14445 15.64358 57.52523 1289.293 59.41179 13.87878
## Feb 2015 79.44558 113.80051 15.59171 56.85268 1287.332 59.24585 13.80950
## Mar 2015 77.92155 111.62187 15.52297 55.61683 1273.861 59.67840 13.79718
## Apr 2015 75.65801 108.54849 15.37741 54.08160 1251.603 60.29312 13.78686
## May 2015 75.05941 106.22762 15.27424 52.50562 1250.422 60.37707 13.65151
## Jun 2015 80.05886 108.41871 14.90380 52.21813 1310.855 59.55553 13.49902
## Jul 2015 82.96959 109.40072 13.90808 51.64122 1343.264 59.23863 13.30899
## Aug 2015 79.52683 104.72028 12.79665 49.60601 1301.772 59.78697 13.11027
## Sep 2015 77.57935 100.69503 12.18472 48.32174 1274.409 59.91766 13.12766
## Oct 2015 77.70708  99.19246 12.15476 47.74534 1273.692 59.43537 13.19377
## Nov 2015 77.50339  98.78101 12.24178 47.22449 1272.084 59.25449 13.23718
## Dec 2015 77.69321  98.90798 12.18667 46.93686 1269.799 60.71295 13.29616
## Jan 2016 78.40901  99.15127 12.06050 46.68166 1270.617 62.19864 13.40031
## Feb 2016 79.13415  99.20784 11.97459 46.70876 1272.392 61.26422 13.51402
## Mar 2016 79.59116  99.15427 11.86682 47.20160 1269.745 60.17299 13.64003
## Apr 2016 80.09264  99.07522 11.68967 47.73337 1274.579 59.39684 13.66567
## May 2016 79.54603  99.12493 11.43155 48.42248 1271.659 58.69829 13.69005
## Jun 2016 78.37778  99.08016 10.97994 49.56147 1242.792 58.57725 13.79712
## Jul 2016 80.37095 101.36544 10.45759 50.99225 1250.918 58.45062 13.98100
## Aug 2016 83.95796 105.12907 10.27398 52.67401 1286.541 58.15206 14.17570
## Sep 2016       NA        NA       NA       NA       NA       NA       NA
## Oct 2016       NA        NA       NA       NA       NA       NA       NA
## Nov 2016       NA        NA       NA       NA       NA       NA       NA
## Dec 2016       NA        NA       NA       NA       NA       NA       NA
## Jan 2017       NA        NA       NA       NA       NA       NA       NA
## Feb 2017       NA        NA       NA       NA       NA       NA       NA
##              [,8]     [,9]      [,10]    [,11]
## Mar 2013       NA       NA         NA       NA
## Apr 2013       NA       NA         NA       NA
## May 2013       NA       NA         NA       NA
## Jun 2013       NA       NA         NA       NA
## Jul 2013       NA       NA         NA       NA
## Aug 2013       NA       NA         NA       NA
## Sep 2013 1009.476 2.951774 0.05407861 1.577661
## Oct 2013 1009.623 3.254904 0.05326058 1.554694
## Nov 2013 1009.660 3.476331 0.05691724 1.539731
## Dec 2013 1009.612 3.363550 0.06443386 1.551700
## Jan 2014 1009.740 3.245931 0.05920406 1.558304
## Feb 2014 1010.007 3.096155 0.05192919 1.562449
## Mar 2014 1010.141 2.983529 0.05139454 1.567836
## Apr 2014 1010.058 2.992701 0.04893337 1.569068
## May 2014 1010.232 3.115946 0.04896641 1.554449
## Jun 2014 1010.752 3.077929 0.04894905 1.565228
## Jul 2014 1011.103 2.911022 0.04897145 1.585036
## Aug 2014 1011.004 2.745416 0.04928527 1.600029
## Sep 2014 1011.004 2.458400 0.04994072 1.632404
## Oct 2014 1011.224 2.196838 0.05187303 1.685357
## Nov 2014 1011.392 2.088793 0.05171640 1.740298
## Dec 2014 1011.547 1.990261 0.04741626 1.783543
## Jan 2015 1011.733 1.861617 0.05367280 1.814131
## Feb 2015 1011.941 1.831190 0.06198933 1.829420
## Mar 2015 1012.148 1.842649 0.06491159 1.850700
## Apr 2015 1012.377 1.752685 0.06838270 1.889152
## May 2015 1012.531 1.830903 0.07057486 1.915873
## Jun 2015 1012.522 2.370704 0.07285104 1.902411
## Jul 2015 1012.654 2.565944 0.07297424 1.909815
## Aug 2015 1013.069 2.278331 0.07303351 1.957631
## Sep 2015 1013.270 2.215837 0.07271755 1.977361
## Oct 2015 1013.137 2.178367 0.07030510 1.966344
## Nov 2015 1013.097 2.076739 0.06808307 1.951177
## Dec 2015 1013.201 2.075511 0.06635872 1.932822
## Jan 2016 1013.192 2.183994 0.07119799 1.928423
## Feb 2016 1013.173 2.311587 0.07535905 1.931531
## Mar 2016 1013.097 2.358539 0.07407900 1.929675
## Apr 2016 1013.071 2.500668 0.07912175 1.912200
## May 2016 1013.010 2.524372 0.08135200 1.897109
## Jun 2016 1012.866 2.332647 0.07936518 1.879979
## Jul 2016 1012.803 2.467593 0.07923637 1.856368
## Aug 2016 1012.742 2.748616 0.07872507 1.829655
## Sep 2016       NA       NA         NA       NA
## Oct 2016       NA       NA         NA       NA
## Nov 2016       NA       NA         NA       NA
## Dec 2016       NA       NA         NA       NA
## Jan 2017       NA       NA         NA       NA
## Feb 2017       NA       NA         NA       NA
## 
## $random
##          x/seasonal.x.PM2.5 x/seasonal.x.PM10 x/seasonal.x.SO2 x/seasonal.x.NO2
## Mar 2013                 NA                NA               NA               NA
## Apr 2013                 NA                NA               NA               NA
## May 2013                 NA                NA               NA               NA
## Jun 2013                 NA                NA               NA               NA
## Jul 2013                 NA                NA               NA               NA
## Aug 2013                 NA                NA               NA               NA
## Sep 2013          0.4701324         0.6786612        0.3290449        0.6790627
## Oct 2013          1.0741526         1.0750691        0.5435682        1.2191412
## Nov 2013          1.3928397         1.3412723        1.2708814        1.4481077
## Dec 2013          2.3393035         2.2122256        3.7111312        2.4845030
## Jan 2014          4.6757474         4.4328640        8.2857359        4.8053447
## Feb 2014          4.7991632         3.8120982        6.8886468        3.4179495
## Mar 2014          1.9220363         2.1847060        2.6703976        1.9234147
## Apr 2014          1.0155470         1.1914006        0.7799362        0.9640001
## May 2014          0.5377936         0.7415333        0.4922663        0.6419878
## Jun 2014          0.3985469         0.3988991        0.1668145        0.4715184
## Jul 2014          0.5172295         0.4759027        0.1271120        0.3581806
## Aug 2014          0.4569311         0.4573195        0.1257256        0.5011947
## Sep 2014          0.5908391         0.5658423        0.2268019        0.6956010
## Oct 2014          1.3728149         1.1932408        0.4975225        1.2969613
## Nov 2014          1.8948262         1.8141785        1.3565146        1.9842650
## Dec 2014          1.8525228         2.1302445        4.7817002        2.4684388
## Jan 2015          4.5650571         3.9716725        8.9675850        4.7901207
## Feb 2015          3.5099018         3.1840393        5.0583505        2.8324682
## Mar 2015          1.9356166         2.4008325        2.5885075        1.8563413
## Apr 2015          0.9983957         1.1734689        0.6626356        0.9645483
## May 2015          0.6104632         0.7309661        0.4910325        0.6607944
## Jun 2015          0.4634553         0.4663200        0.2880361        0.4476207
## Jul 2015          0.4014797         0.3827684        0.1919849        0.3997753
## Aug 2015          0.3537819         0.3997872        0.1496158        0.4395710
## Sep 2015          0.4796494         0.4772024        0.2852953        0.6266489
## Oct 2015          0.9987052         0.9936545        0.4452966        1.1651549
## Nov 2015          2.4416231         2.0049151        1.7930293        1.9230897
## Dec 2015          4.7813753         3.9719975        4.4442642        3.5254259
## Jan 2016          3.4460015         3.2025756        7.2549857        4.0720772
## Feb 2016          1.6548318         1.6788899        3.8787532        1.9956841
## Mar 2016          2.0657351         2.2791386        2.9908433        1.9757068
## Apr 2016          0.8800968         1.1610443        1.0511590        0.9155118
## May 2016          0.5751221         0.7989694        0.6628087        0.6404486
## Jun 2016          0.5103706         0.5176826        0.3105184        0.4407078
## Jul 2016          0.4988476         0.4379960        0.1718891        0.3659184
## Aug 2016          0.3708097         0.3788714        0.1594429        0.4644904
## Sep 2016                 NA                NA               NA               NA
## Oct 2016                 NA                NA               NA               NA
## Nov 2016                 NA                NA               NA               NA
## Dec 2016                 NA                NA               NA               NA
## Jan 2017                 NA                NA               NA               NA
## Feb 2017                 NA                NA               NA               NA
##          x/seasonal.x.CO x/seasonal.x.O3 x/seasonal.x.TEMP x/seasonal.x.PRES
## Mar 2013              NA              NA                NA                NA
## Apr 2013              NA              NA                NA                NA
## May 2013              NA              NA                NA                NA
## Jun 2013              NA              NA                NA                NA
## Jul 2013              NA              NA                NA                NA
## Aug 2013              NA              NA                NA                NA
## Sep 2013       0.5964067       0.7547941      1.0700491783         0.6993048
## Oct 2013       0.8919380       0.6039034      0.9565675996         1.0032880
## Nov 2013       1.5298365       0.5964356      0.6354374035         1.5182968
## Dec 2013       3.2618892       0.5706826     -0.0008380838         2.2614352
## Jan 2014       5.2645158       0.8306781      0.0441972336         3.6240171
## Feb 2014       4.5424280       0.9063975      0.0171673513         2.7394908
## Mar 2014       1.7656659       1.5087689      1.2886545842         1.7318961
## Apr 2014       0.7804800       1.3249100      1.2762892222         1.0507290
## May 2014       0.5310464       1.3951589      1.2739687396         0.8201167
## Jun 2014       0.4259333       1.1657621      1.0929717397         0.6171134
## Jul 2014       0.3433185       1.0007804      1.0778141675         0.5339051
## Aug 2014       0.4562161       1.0032582      1.1322357224         0.6102853
## Sep 2014       0.6076649       0.6362556      1.0386892246         0.6979714
## Oct 2014       1.0375168       0.4458168      0.9947749536         1.0001416
## Nov 2014       2.0669520       0.5568253      0.6863479112         1.5242558
## Dec 2014       3.2504131       1.0967825     -0.0363116507         2.2720517
## Jan 2015       5.6016435       1.4640034     -0.0324733968         3.6227896
## Feb 2015       3.2759779       1.7693606      0.3418701821         2.7234910
## Mar 2015       1.7049005       1.5712095      1.0565627263         1.7352954
## Apr 2015       0.7020212       1.3605590      1.1917764352         1.0496674
## May 2015       0.5158896       1.3447471      1.3011914054         0.8204836
## Jun 2015       0.4122640       0.9720916      1.1345634475         0.6166541
## Jul 2015       0.3940415       0.8681353      1.0730701936         0.5349317
## Aug 2015       0.4303517       1.0338442      1.2417979821         0.6099690
## Sep 2015       0.5255553       0.6818258      1.0986623118         0.6987873
## Oct 2015       0.8177741       0.6198545      1.0828896712         1.0002889
## Nov 2015       2.4733603       0.3603199      0.3245793951         1.5241071
## Dec 2015       5.3357205       0.6627487     -0.0611227761         2.2642971
## Jan 2016       4.6312622       1.6259273     -1.2189943480         3.6352950
## Feb 2016       1.9878625       2.1185953      0.2802566940         2.7334329
## Mar 2016       1.6649021       1.3837150      1.1652302497         1.7334425
## Apr 2016       0.7027690       1.2838712      1.2657761794         1.0457714
## May 2016       0.4715715       1.3994537      1.3106714925         0.8218053
## Jun 2016       0.4348422       1.3490239      1.1642481136         0.6167009
## Jul 2016       0.4316177       0.8965469      1.0718592053         0.5345097
## Aug 2016       0.4464486       0.8062961      1.2104845181         0.6102789
## Sep 2016              NA              NA                NA                NA
## Oct 2016              NA              NA                NA                NA
## Nov 2016              NA              NA                NA                NA
## Dec 2016              NA              NA                NA                NA
## Jan 2017              NA              NA                NA                NA
## Feb 2017              NA              NA                NA                NA
##          x/seasonal.x.DEWP x/seasonal.x.RAIN x/seasonal.x.WSPM
## Mar 2013                NA                NA                NA
## Apr 2013                NA                NA                NA
## May 2013                NA                NA                NA
## Jun 2013                NA                NA                NA
## Jul 2013                NA                NA                NA
## Aug 2013                NA                NA                NA
## Sep 2013         3.4511118       1.488809394         0.5151989
## Oct 2013         1.6281753       0.319773353         0.8582672
## Nov 2013        -3.1230488       0.022089470         1.7334058
## Dec 2013        -8.8425974       0.000000000         2.4541779
## Jan 2014       -14.0359936       0.000000000         3.7288813
## Feb 2014        -8.3802223       0.512231566         2.4930449
## Mar 2014        -3.3996882       0.004517107         1.9942515
## Apr 2014         1.3922750       0.387884998         1.0823743
## May 2014         1.8432996       1.547600117         1.0758793
## Jun 2014         3.3139400       2.525448835         0.5556696
## Jul 2014         3.6338142       0.642949165         0.5051488
## Aug 2014         4.0667768       1.726529543         0.5372505
## Sep 2014         3.9332496       0.767141930         0.5621943
## Oct 2014         2.8479693       0.351594261         0.7205116
## Nov 2014        -3.7539314       0.012155444         1.3337564
## Dec 2014       -18.2208623       0.000000000         2.7496911
## Jan 2015       -26.5842339       0.035961514         3.1756419
## Feb 2015       -18.4285853       0.734675356         2.6824103
## Mar 2015        -9.2620038       0.236047321         2.0658963
## Apr 2015         1.0163807       0.856175750         1.3817098
## May 2015         2.9905075       0.588123761         1.0678418
## Jun 2015         3.7652753       1.167337983         0.6497070
## Jul 2015         3.9017995       2.002895060         0.4609746
## Aug 2015         4.9860743       1.060844563         0.5082011
## Sep 2015         4.3506946       1.321149496         0.5671896
## Oct 2015         1.9022074       0.270860670         0.9380922
## Nov 2015        -0.8735008       1.157248481         1.1970166
## Dec 2015        -7.8008382       0.095290065         2.1517460
## Jan 2016       -29.6868191       0.033887106         3.9375337
## Feb 2016       -17.6779109       0.650622523         3.4341147
## Mar 2016        -6.4098642       0.000000000         1.8348120
## Apr 2016        -0.1399512       0.088574791         1.3096994
## May 2016         2.0340097       0.466440336         0.9634952
## Jun 2016         3.9289423       0.779886790         0.5986210
## Jul 2016         4.5443690       2.890797901         0.4951249
## Aug 2016         4.3213338       0.566726820         0.5447426
## Sep 2016                NA                NA                NA
## Oct 2016                NA                NA                NA
## Nov 2016                NA                NA                NA
## Dec 2016                NA                NA                NA
## Jan 2017                NA                NA                NA
## Feb 2017                NA                NA                NA
## 
## $figure
##  [1] 0.5789615 0.9512677 1.2078615 1.6021536 1.8483973 1.6237867 1.4283454
##  [8] 1.0022651 0.6628109 0.4463759 0.2785447 0.3692298
## 
## $type
## [1] "multiplicative"
## 
## attr(,"class")
## [1] "decomposed.ts"

Now, we check the fundamental changes of different air pollutants and weather conditions in 2014 to 2017.

plot(multi_decomp$x[,1:6])

plot(multi_decomp$x[,7:11])

Then we also check the fundamental changes in the four components in different column in 2014 to 2017.

In the trend, we found that the trend of air pollutants(PM2.5, PM10, SO2, NO2, CO) shows a remarkable decline since 2014. And the trend of air pollutants(O3) shows a remarkable ascend since 2014.

plot(multi_decomp$seasonal[1:60], type = "l")

plot(multi_decomp$trend[,1:6])

plot(multi_decomp$trend[,7:11])

plot(multi_decomp$random[,1:6])

plot(multi_decomp$random[,7:11])

We found that the multiplicative decomposition model and additive decomposition model shows similar result.

Moving average smoothing (monthly)

Building Seasonal-Trend decomposition model (STL)

STL.PM2.5<- stl( ts_by_month[,'PM2.5'] , t.window = 13, s.window = 'periodic')
plot(STL.PM2.5)

STL.PM10<- stl( ts_by_month[,'PM10'] , t.window = 13, s.window = 'periodic')
plot(STL.PM10)

STL.NO2<- stl( ts_by_month[,'NO2'] , t.window = 13, s.window = 'periodic')
plot(STL.NO2)

STL.SO2<- stl( ts_by_month[,'NO2'] , t.window = 13, s.window = 'periodic')
plot(STL.SO2)

STL.CO<- stl( ts_by_month[,'CO'] , t.window = 13, s.window = 'periodic')
plot(STL.CO)

STL.O3<- stl( ts_by_month[,'O3'] , t.window = 13, s.window = 'periodic')
plot(STL.O3)

STL.TEMP<- stl( ts_by_month[,'TEMP'] , t.window = 13, s.window = 'periodic')
plot(STL.TEMP)

STL.PRES<- stl( ts_by_month[,'PRES'] , t.window = 13, s.window = 'periodic')
plot(STL.PRES)

STL.RAIN<- stl( ts_by_month[,'RAIN'] , t.window = 13, s.window = 'periodic')
plot(STL.RAIN)

Tesk for random / remainder for the STL model using Ljung-Box Test (monthly)

auto.arima(remainder(STL.PM2.5),trace = T)
## 
##  ARIMA(2,0,2)(1,0,1)[12] with non-zero mean : Inf
##  ARIMA(0,0,0)            with non-zero mean : 422.7225
##  ARIMA(1,0,0)(1,0,0)[12] with non-zero mean : 427.1379
##  ARIMA(0,0,1)(0,0,1)[12] with non-zero mean : Inf
##  ARIMA(0,0,0)            with zero mean     : 420.5498
##  ARIMA(0,0,0)(1,0,0)[12] with non-zero mean : 424.9196
##  ARIMA(0,0,0)(0,0,1)[12] with non-zero mean : 424.5797
##  ARIMA(0,0,0)(1,0,1)[12] with non-zero mean : Inf
##  ARIMA(1,0,0)            with non-zero mean : 424.8169
##  ARIMA(0,0,1)            with non-zero mean : 423.1371
##  ARIMA(1,0,1)            with non-zero mean : 422.5173
## 
##  Best model: ARIMA(0,0,0)            with zero mean
## Series: remainder(STL.PM2.5) 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 = 357.8:  log likelihood = -209.23
## AIC=420.46   AICc=420.55   BIC=422.33
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.PM2.5), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise (PM2.5) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

auto.arima(remainder(STL.PM10))
## Series: remainder(STL.PM10) 
## ARIMA(2,0,1) with zero mean 
## 
## Coefficients:
##          ar1      ar2      ma1
##       0.5851  -0.6317  -0.8254
## s.e.  0.1170   0.1137   0.0924
## 
## sigma^2 = 180:  log likelihood = -192.29
## AIC=392.57   AICc=393.5   BIC=400.06
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.PM10), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise(PM10) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

auto.arima(remainder(STL.SO2))
## Series: remainder(STL.SO2) 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 = 32.73:  log likelihood = -151.83
## AIC=305.65   AICc=305.74   BIC=307.52
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.SO2), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise(SO2) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

auto.arima(remainder(STL.NO2))
## Series: remainder(STL.NO2) 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 = 32.73:  log likelihood = -151.83
## AIC=305.65   AICc=305.74   BIC=307.52
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.NO2), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise(NO2) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

auto.arima(remainder(STL.CO))
## Series: remainder(STL.CO) 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 = 53698:  log likelihood = -329.5
## AIC=660.99   AICc=661.08   BIC=662.86
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.CO), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise(CO) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

auto.arima(remainder(STL.O3))
## Series: remainder(STL.O3) 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 = 51.6:  log likelihood = -162.76
## AIC=327.51   AICc=327.6   BIC=329.38
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.O3), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise(O3) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

auto.arima(remainder(STL.TEMP))
## Series: remainder(STL.TEMP) 
## ARIMA(1,0,1) with zero mean 
## 
## Coefficients:
##          ar1      ma1
##       0.3815  -0.8530
## s.e.  0.2102   0.1376
## 
## sigma^2 = 0.5325:  log likelihood = -52.3
## AIC=110.6   AICc=111.14   BIC=116.21
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.TEMP), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise(TEMP) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

auto.arima(remainder(STL.PRES))
## Series: remainder(STL.PRES) 
## ARIMA(0,0,0) with zero mean 
## 
## sigma^2 = 1.942:  log likelihood = -84.04
## AIC=170.09   AICc=170.17   BIC=171.96
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.PRES), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise(PRES) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

auto.arima(remainder(STL.RAIN))
## Series: remainder(STL.RAIN) 
## ARIMA(2,0,0) with zero mean 
## 
## Coefficients:
##           ar1      ar2
##       -0.5866  -0.2711
## s.e.   0.1379   0.1360
## 
## sigma^2 = 0.001314:  log likelihood = 91.96
## AIC=-177.91   AICc=-177.37   BIC=-172.3
x <- lapply(1:10, function(i){
  p <- Box.test(remainder(STL.RAIN), lag = i, type = "Ljung-Box")
  output <- data.frame(lag = i, p_value = p$p.value)
 return(output) }) %>% bind_rows

plot(x = x$lag,
      y = x$p_value, ylim = c(0,1),
      main = "Series white_noise(RAIN) - Ljung-Box Test",
      xlab = "Lag", ylab = "P-Value")
 
abline(h = 0.05, col="red", lwd=3, lty=2)

The Ljung Box test test the white noise of the timeseries data.

For most of the variable, the residual of the model of lag 1 (AR1) is white noise, such as PM2.5, PM10, SO2, NO2, CO, O3) and for the other model (> lag 2) there exhibit serial correlation among the residual.

forcesting for diffrent varible by using ARIMA forecast

forecast(STL.PM2.5, h=5, method = 'arima')
##          Point Forecast    Lo 80     Hi 80    Lo 95    Hi 95
## Mar 2017       86.21735 61.83649 110.59822 48.93003 123.5047
## Apr 2017       79.49162 54.22798 104.75526 40.85421 118.1290
## May 2017       62.30253 36.08973  88.51534 22.21351 102.3916
## Jun 2017       71.63256 45.41976  97.84536 31.54354 111.7216
## Jul 2017       72.55371 46.34091  98.76652 32.46469 112.6427
STL.PM2.5 %>% forecast(method="arima", h=15) %>%
   autoplot(ylab = 'PM2.5') + ggtitle('Forecasting')

forecast(STL.PM10, h=5, method = 'arima')
##          Point Forecast     Lo 80    Hi 80      Lo 95    Hi 95
## Mar 2017      120.79043 88.517342 153.0635  71.433001 170.1479
## Apr 2017       93.15092 47.509874 138.7920  23.348967 162.9529
## May 2017       84.11630 28.217664 140.0149  -1.373283 169.6059
## Jun 2017       67.14942  2.603237 131.6956 -31.565446 165.8643
## Jul 2017       62.57884 -9.585981 134.7437 -47.787730 172.9454
STL.PM10 %>% forecast(method="arima", h=5) %>%
   autoplot(ylab = 'PM10') + ggtitle('Forecasting')

forecast(STL.SO2, h=5, method = 'arima')
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Mar 2017       68.14126 59.43630 76.84623 54.82818 81.45435
## Apr 2017       53.15557 43.52385 62.78730 38.42512 67.88602
## May 2017       51.10024 41.46850 60.73198 36.36977 65.83072
## Jun 2017       49.34610 39.07363 59.61857 33.63571 65.05648
## Jul 2017       46.14406 35.26854 57.01957 29.51139 62.77672
STL.SO2 %>% forecast(method="arima", h=5) %>%
   autoplot(ylab = 'SO2') + ggtitle('Forecasting')

forecast(STL.NO2, h=5, method = 'arima')
##          Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
## Mar 2017       68.14126 59.43630 76.84623 54.82818 81.45435
## Apr 2017       53.15557 43.52385 62.78730 38.42512 67.88602
## May 2017       51.10024 41.46850 60.73198 36.36977 65.83072
## Jun 2017       49.34610 39.07363 59.61857 33.63571 65.05648
## Jul 2017       46.14406 35.26854 57.01957 29.51139 62.77672
# use other mothed


STL.NO2 %>% forecast(method="arima", h=5) %>%
   autoplot(ylab = 'NO2') + ggtitle('Forecasting')

forecast(STL.CO, h=5, method = 'arima')
##          Point Forecast      Lo 80    Hi 80     Lo 95    Hi 95
## Mar 2017       973.1480  572.96253 1373.333  361.1172 1585.179
## Apr 2017       541.0066  -24.94106 1106.954 -324.5356 1406.549
## May 2017       493.1916 -199.94991 1186.333 -566.8768 1553.260
## Jun 2017       705.9207  -94.45017 1506.292 -518.1409 1929.982
## Jul 2017       653.5837 -241.25813 1548.425 -714.9588 2022.126
STL.CO %>% forecast(method="arima", h=5) %>%
   autoplot(ylab = 'CO') + ggtitle('Forecasting')

forecast(STL.O3, h=5, method = 'arima')
##          Point Forecast    Lo 80     Hi 80    Lo 95     Hi 95
## Mar 2017       54.48040 43.83217  65.12862 38.19534  70.76545
## Apr 2017       70.76883 58.73549  82.80218 52.36542  89.17224
## May 2017       92.69411 80.44298 104.94525 73.95762 111.43061
## Jun 2017      100.41208 87.94696 112.87721 81.34833 119.47584
## Jul 2017       97.26549 84.59000 109.94099 77.88000 116.65099
STL.O3 %>% forecast(method="arima", h=5) %>%
   autoplot(ylab = 'O3') + ggtitle('Forecasting')

forecast(STL.TEMP, h=5, method = 'arima')
##          Point Forecast     Lo 80    Hi 80     Lo 95    Hi 95
## Mar 2017       8.959632  7.553627 10.36564  6.809334 11.10993
## Apr 2017      15.694990 14.288986 17.10099 13.544692 17.84529
## May 2017      21.823893 20.417889 23.22990 19.673595 23.97419
## Jun 2017      24.808395 23.402391 26.21440 22.658097 26.95869
## Jul 2017      27.394304 25.988299 28.80031 25.244006 29.54460
STL.TEMP %>% forecast(method="arima", h=5) %>%
   autoplot(ylab = 'TEMP') + ggtitle('Forecasting')

forecast(STL.PRES, h=5, method = 'arima')
##          Point Forecast     Lo 80    Hi 80     Lo 95    Hi 95
## Mar 2017       1017.000 1014.9299 1019.070 1013.8341 1020.166
## Apr 2017       1011.356 1009.2789 1013.433 1008.1794 1014.532
## May 2017       1005.427 1003.3427 1007.511 1002.2394 1008.614
## Jun 2017       1002.406 1000.3147 1004.497  999.2077 1005.604
## Jul 2017       1001.271  999.1734 1003.370  998.0628 1004.480
STL.PRES %>% forecast(method="arima", h=5) %>%
   autoplot(ylab = 'PRES') + ggtitle('Forecasting')

forecast(STL.RAIN, h=5, method = 'arima')
##          Point Forecast       Lo 80      Hi 80       Lo 95      Hi 95
## Mar 2017    0.009683263 -0.04728248 0.06664901 -0.07743833 0.09680485
## Apr 2017    0.022910496 -0.03598979 0.08181078 -0.06716972 0.11299071
## May 2017    0.048501231 -0.01053034 0.10753280 -0.04177976 0.13878222
## Jun 2017    0.133140859  0.07410023 0.19218148  0.04284601 0.22343570
## Jul 2017    0.257254452  0.19821320 0.31629570  0.16695865 0.34755025
STL.RAIN %>% forecast(method="arima", h=5) %>%
   autoplot(ylab = 'RAIN') + ggtitle('Forecasting')

The forecast plot shows the predict value of diffreient variable of the next five months on difference variable.

Conclusion

We find out that,

The air pollution in Beijing condition are correlated with the weather condition.

The air pollution condition will change in different season.

For all air pollutant except O3, there will be a higher concentration in winter and lower concentration in summer.

For O3, there will be a higher concentration in winter and lower concentration in summer. Air pollution have pattern among hourly,weekly and monthly.